package com.csxy.yhj.controller;

import com.csxy.yhj.entity.CareSe;
import com.csxy.yhj.entity.Caregiver;
import com.csxy.yhj.service.CareSeService;
import com.csxy.yhj.service.CaregiverService;
import com.csxy.yhj.yhj.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/eduservice/indexFront")
public class IndexFrontController {
    @Autowired
    private CareSeService careSeService;
    @Autowired
    private CaregiverService caregiverService;
    //首页查询前8条热门服务和前4条热门护工

    @GetMapping("/index")
    public R index() {
        //调用查询前8条热门服务
        List<CareSe> courseList = careSeService.selectHotCare();
        //查询前4个热门护工
        List<Caregiver> CaregiverList = caregiverService.selectHotTeacher();

        return R.ok().data("courseList", courseList).data("teacherList", CaregiverList);
    }
}
